package com.hp.demo;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface DeviceLogMapper extends BaseMapper<DeviceLog> {

    /**
     * 检索user表的长度
     *
     * @return 表长度
     */
    @Select("SELECT count(*) as sum FROM device_log")
    Integer countDeviceLog();

    /**
     * 检索user表的所有记录
     *
     * @return 所有记录信息
     */
    @Select("SELECT ID, DEVICE_ID, CREATE_TIME, PROJECT_ID, DEVICE_TYPE_ID, DEVICE_MODE_ID, PLC_DATA, IS_OFFLINE, MESSAGE_ID, GMT_CREATE FROM device_log LIMIT #{startLen}, 50000")
    List<DeviceLog> subList(@Param("startLen") int startLen);


    @Select("SELECT ID, DEVICE_ID, CREATE_TIME, PROJECT_ID, DEVICE_TYPE_ID, DEVICE_MODE_ID, PLC_DATA, IS_OFFLINE, MESSAGE_ID, GMT_CREATE FROM device_log")
    List<DeviceLog> listAll();
}